<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
      xmlns:c="http://java.sun.com/jsp/jstl/core">

<ui:composition template="/Templates/Template.xhtml">
	
	<ui:define name="contenu">

		<c:choose>
			<c:when test="#{loginBean.exist()}">
		
		<br />

		<h:form id="a">
			<p:growl id="growl" showDetail="true" sticky="true" life="4000"/>
			<div align="center">
			<p:dataTable var="infermiere" value="#{infermiereBean.infermieres}"
				filteredValue="#{infermiereBean.filteredInfermiere}" id="AjoutTab"
				widgetVar="infermiereTable" paginatorPosition="bottom"
				emptyMessetat="infermiere non trouvé" paginator="true" rows="10"
				paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
				rowsPerPageTemplate="5,10,15" sortMode="multiple"
				style="width:900px;font-size:12px;font-weight:400;">

				<f:facet name="header">
					<p:outputPanel>
						<h:outputText value="Recherche:" />
						<p:inputText id="globalFilter" onkeyup="infermiereTable.filter()"
							style="width:80px;" />
							<c:if test="#{loginBean.e.libelle=='Administrateur'}">
						<p:commandButton value="&nbsp;Ajouter une infermiere"
							style="float:right;height:30px" image="ui-icon-circule-plus"
							actionListener="#{infermiereBean.ajoutEvent()}" update=":edit:editP"
							oncomplete="infermiereAjout.show()" />
							</c:if>
					</p:outputPanel>
				</f:facet>

				<p:column id="infermiereId" headerText="ID" sortBy="#{infermiere.id}">

					<h:outputText value="#{infermiere.id}" />


				</p:column>
				<p:column headerText="Nom" id="infermiereNom" filterBy="#{infermiere.nom}"
					filterMatchMode="contains">

					<h:outputText value="#{infermiere.nom}" />

				</p:column>
				<p:column headerText="Prenom" id="infermierePrenom"
					filterBy="#{infermiere.prenom}" filterMatchMode="contains">
					<h:outputText value="#{infermiere.prenom}" />
				</p:column>
				<p:column headerText="Etat Civil" id="infermiereetat">
					<h:outputText value="#{infermiere.etatcivil}" />
				</p:column>
				<p:column headerText="tel" id="infermieretel">
					<h:outputText value="#{infermiere.tel}" />
				</p:column>
				
					
					
			<c:if test="#{loginBean.e.libelle=='Administrateur'}">
				<p:column style="width:4%">
					<p:commandButton id="Editer" update=":Actualise:displaye"
						icon="ui-icon-arrowrefresh-1-w" oncomplete="infermiereEdit.show();"
						title="Editer" >
							<f:setPropertyActionListener value="#{infermiere}"
							target="#{infermiereBean.infermiere}" />
						</p:commandButton>
				</p:column>
				<p:column style="width:4%">
					<p:commandButton id="Supprimer" icon="ui-icon-trash" update=":supp:confirmDialog"
						oncomplete="confirmation.show()" title="Supprime">
						<f:setPropertyActionListener value="#{infermiere}"
							target="#{infermiereBean.infermiere}" />
					</p:commandButton>
				</p:column>
				</c:if>
			</p:dataTable></div>
		</h:form>

		<h:form id="edit">

			<p:dialog header="Ajout de infermiere" widgetVar="infermiereAjout"
				resizable="false" id="editP">

				<p:growl id="growledit" showDetail="true" sticky="true" life="2000"/>
				<h:panelGrid id="display" columns="2" cellpadding="4"
					style="margin:0 auto;">

	
					<h:outputLabel value=""  />
					<h:inputHidden value="#{infermiereBean.infermiere.id}" id="id"
						required="true" />
					
				
					<h:outputLabel for="nom" value="Nom:"
						style="color: black;font-weight: bold" />
					<p:inputText value="#{infermiereBean.infermiere.nom}" id="nom"
						required="true" requiredMessage="Nom" />
					<h:outputLabel for="prenom" value="Prenom:"
						style="color: black;font-weight: bold" />
					<p:inputText value="#{infermiereBean.infermiere.prenom}" id="prenom"
						required="true" requiredMessage="Prenom" />
					<h:outputLabel for="etat" value="Etat Civil :"
						style="color: black;font-weight: bold" />
					<h:outputLabel for="tel" value="Telehpone :"
						style="color: black;font-weight: bold" />
					<p:selectOneListbox id="etat"
						value="#{infermiereBean.infermiere.etatcivil}"
						requiredMessage="Etat Civil" required="true">
						<f:selectItem itemLabel="Marié(e)" itemValue="Marie" />
						<f:selectItem itemLabel="Celibataire" itemValue="Celibataire" />
					</p:selectOneListbox>
					<p:inputText value="#{infermiereBean.infermiere.tel}" id="tel" />

					<h:outputLabel for="Sexe" value="Sexe :"
						style="color: black;font-weight: bold" />
					<h:outputLabel for="Date" value="Date de naissance :"
						style="color: black;font-weight: bold" />
					<p:selectOneListbox id="Sexe" value="#{infermiereBean.infermiere.sexe}"
						requiredMessage="Sexe" required="true">
						<f:selectItem itemLabel="Homme" itemValue="Homme" />
						<f:selectItem itemLabel="Femme" itemValue="Femme" />
					</p:selectOneListbox>

					<p:calendar value="#{infermiereBean.infermiere.datenaissance}" id="Date"
						required="true" requiredMessage="Date de naissance" />


					
					<p:outputLabel value="Service :"
						style="color: black;font-weight: bold" />


					<p:selectOneMenu id="Service"
						value="#{infermiereBean.selectedService}" effect="drop">
						
						<f:selectItems value="#{serviceBean.services}"
							var="service" itemLabel="#{service.nomservce}"
							itemValue="#{service.idservive}" />

					</p:selectOneMenu>
					<h:outputLabel for="Adresse" value="Adresse :"
						style="color: black;font-weight: bold" />

					<p:inputText value="#{infermiereBean.infermiere.adresse}" id="Adresse" />

				</h:panelGrid>
				<p:separator />
				<p:commandButton value="Enregistrer" update=":a:AjoutTab, :a:growl"
					actionListener="#{infermiereBean.ajoutp()}"
					oncomplete="infermiereAjout.hide()" />
			</p:dialog>

		</h:form>

		<h:form id="Actualise">

			<p:dialog header="Modification" widgetVar="infermiereEdit"
				resizable="false" id="editPer">

				<p:growl id="growledit" showDetail="true" sticky="true" life="4000"/>
				<h:panelGrid id="displaye" columns="2" cellpadding="4"
					style="margin:0 auto;">

	
					<h:outputLabel value="" for="id" />
					<h:inputHidden value="#{infermiereBean.infermiere.id}" id="id"
						required="true" />
					
				
					<h:outputLabel for="nom" value="Nom:"
						style="color: black;font-weight: bold" />
					<p:inputText value="#{infermiereBean.infermiere.nom}" id="nom"
						required="true" requiredMessage="Nom" />
					<h:outputLabel for="prenom" value="Prenom:"
						style="color: black;font-weight: bold" />
					<p:inputText value="#{infermiereBean.infermiere.prenom}" id="prenom"
						required="true" requiredMessage="Prenom" />
					<h:outputLabel for="etat" value="Etat Civil :"
						style="color: black;font-weight: bold" />
					<h:outputLabel for="tel" value="Telehpone :"
						style="color: black;font-weight: bold" />
					<p:selectOneListbox id="etat"
						value="#{infermiereBean.infermiere.etatcivil}"
						requiredMessage="Etat Civil" required="true">
						<f:selectItem itemLabel="Marié(e)" itemValue="Marie" />
						<f:selectItem itemLabel="Celibataire" itemValue="Celibataire" />
					</p:selectOneListbox>
					<p:inputText value="#{infermiereBean.infermiere.tel}" id="tel" />

					<h:outputLabel for="Sexe" value="Sexe :"
						style="color: black;font-weight: bold" />
					<h:outputLabel for="Date" value="Date de naissance :"
						style="color: black;font-weight: bold" />
					<p:selectOneListbox id="Sexe" value="#{infermiereBean.infermiere.sexe}"
						requiredMessage="Sexe" required="true">
						<f:selectItem itemLabel="Homme" itemValue="Homme" />
						<f:selectItem itemLabel="Femme" itemValue="Femme" />
					</p:selectOneListbox>

					<p:calendar value="#{infermiereBean.infermiere.datenaissance}" id="Date"
						required="true" requiredMessage="Date de naissance" />


					
					<p:outputLabel value="Service :"
						style="color: black;font-weight: bold" />

					

					<p:selectOneMenu id="Service"
						value="#{infermiereBean.selectedService}" effect="drop">
						
						<f:selectItems value="#{serviceBean.services}" 
							var="service" itemLabel="#{service.nomservce}"
							itemValue="#{service.idservive}" />

					</p:selectOneMenu>
					<h:outputLabel for="Adresse" value="Adresse :"
						style="color: black;font-weight: bold" />

					<p:inputText value="#{infermiereBean.infermiere.adresse}" id="Adresse" />

				</h:panelGrid>
				<p:separator />
				<p:commandButton value="Enregistrer" update=":a:AjoutTab, :a:growl"
					actionListener="#{infermiereBean.edition()}"
					oncomplete="infermiereEdit.hide()" />
			</p:dialog>

		</h:form>
		
		<h:form id="supp">
				
			<p:dialog id="confirmDialog" showEffect="fade"
				
				header="Suppression d'un Medecin" severity="alert"
				widgetVar="confirmation">
				<p:growl id="messages" showDetail="true" sticky="true" life="4000"/>
			<h:inputHidden value="#{infermiereBean.infermiere.id}" id="supp"
						required="true" />
						<p:outputLabel value="Etes vous sûr de vouloir supprimer ce Medecin ?" />
				<p:commandButton id="confirm" value="Yes Sure" update="messages,:a:AjoutTab"
					oncomplete="confirmation.hide()"
					actionListener="#{infermiereBean.delet()}" />
				<p:commandButton id="decline" value="Not Yet"
					onclick="confirmation.hide()" type="button" />

			</p:dialog>

		</h:form>
		</c:when>

			<c:otherwise>
			<script language="javascript"><!--
location.replace("Login.jsf")
//-->
</script>
				
			</c:otherwise>
		</c:choose>
	</ui:define>
</ui:composition>
</html>